Wiki

Clone wiki

inf225public / glossary / Duck typing

[Alphabetical Index | Tag Index]

Duck typing*

A typing style where the exact type of an object is not important, rather, any object is usable in any situation as long as it supports whatever methods are called on it. Used in many dynamic languages, such as Python, and in C++ templates. C.f. structural typing. Named after the duck test (attributed to James Whitcomb Riley): “When I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck.”

[Wikipedia]

Updated